package com.zf.shuashua.video;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.aliyun.apsara.alivclittlevideo.net.data.LittleMineVideoInfo;
import com.aliyun.apsara.alivclittlevideo.view.video.BaseVideoSourceModel;
import com.aliyun.apsara.alivclittlevideo.view.video.videolist.BaseVideoListAdapter;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.lxj.xpopup.XPopup;
import com.meis.base.mei.utils.NumberUtils;
import com.vise.xsnow.http.callback.ACallback;
import com.zf.shuashua.R;
import com.zf.shuashua.ShuaApplication;
import com.zf.shuashua.api.AbsCallback;
import com.zf.shuashua.api.Constants;
import com.zf.shuashua.api.HttpData;
import com.zf.shuashua.api.Store;
import com.zf.shuashua.bean.BaseData;
import com.zf.shuashua.bean.FocusType;
import com.zf.shuashua.bean.ToggleLikeBean;
import com.zf.shuashua.bean.VideoInfo;
import com.zf.shuashua.manager.track.TrackConstants;
import com.zf.shuashua.manager.track.TrackManager;
import com.zf.shuashua.ui.home.ShareVideoPopup;
import com.zf.shuashua.ui.mine.FriendsDetailsActivity;
import com.zf.shuashua.ui.mine.LogUtil;
import com.zf.shuashua.ui.mine.LoginActivity;
import com.zf.shuashua.utils.ToastUtil;

/**
 * 视频列表的adapter
 *
 * @author zf
 */
public class LittleVideoListAdapter extends BaseVideoListAdapter<LittleVideoListAdapter.MyHolder, BaseVideoSourceModel> {
    public static final String TAG = LittleVideoListAdapter.class.getSimpleName();
    private OnItemBtnClick mItemBtnClick;
    private Context mContext;
    private MyHolder mCurrentHolder;

    public LittleVideoListAdapter(Context context) {
        super(context);
        this.mContext = context;
    }

    @NonNull
    @Override
    public LittleVideoListAdapter.MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_view_pager, viewGroup, false);
        return new MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull final MyHolder myHolder, final int position) {
        super.onBindViewHolder(myHolder, position);
        final BaseVideoSourceModel data = getDataList().get(position);
        myHolder.setCurrentModel(data);
        data.currentHolder = myHolder;
        myHolder.itemView.setTag(myHolder.getAdapterPosition()); // tag must
        if (data.getType() == 100) {
        } else {
            myHolder.root.setVisibility(View.VISIBLE);
            //用户点赞
            myHolder.mLove.setTag("praise");
            myHolder.mLove.setOnClickListener(v -> {
                if (!Store.getInstance().isLogin()) {
                    mContext.startActivity(new Intent(mContext, LoginActivity.class));
                } else {
                    v.setEnabled(false);
                    boolean isPraise = data.isLove();
                    isPraise = !isPraise;
                    int praiseCount = data.getPraiseCount();
                    if (isPraise) {
                        data.setPraiseCount(praiseCount + 1);
                    } else {
                        data.setPraiseCount((praiseCount - 1) < 0 ? 0 : (praiseCount - 1));
                    }
                    data.setLove(isPraise);
                    myHolder.tvPraiseCount.setText(NumberUtils.INSTANCE.convertOneDecimalW(data.getPraiseCount()));
                    myHolder.loveIcon.setBackgroundResource(data.isLove() ? R.drawable.like_selected : R.drawable.love);

                    final boolean isFinalPraise = isPraise;
                    reportAdvertAction(TrackConstants.ACTION_HOME_LIKE, TrackConstants.NOTE_HOME_LIKE);
                    HttpData.getInstance().toToggleLike(data.getId(), new AbsCallback<BaseData<ToggleLikeBean>>() {
                        @Override
                        public void onRealSuccess(BaseData<ToggleLikeBean> data2) {
                            if (data2 == null || data2.getData() == null) {
                                ToastUtil.showToast(mContext, "系统错误");
                                return;
                            }
                            myHolder.loveIcon.setBackgroundResource(data.isLove() ? R.drawable.like_selected : R.drawable.love);
                            v.setEnabled(true);
                        }

                        @Override
                        public void onFail(int errCode, String errMsg) {
                            int praiseCount = data.getPraiseCount();
                            if (!isFinalPraise) {
                                data.setPraiseCount(praiseCount + 1);
                            } else {
                                data.setPraiseCount((praiseCount - 1) < 0 ? 0 : (praiseCount - 1));
                            }
                            data.setLove(!isFinalPraise);
                            myHolder.tvPraiseCount.setText(NumberUtils.INSTANCE.convertOneDecimalW(data.getPraiseCount()));
                            v.setEnabled(true);
                        }
                    });
                }
            });

            //用户详情
            myHolder.ivIcon.setOnClickListener(v -> {
                if (data.getType() == Constants.AD.ad_item_type) {
                    return;
                }
                if (data.getUser() != null && !TextUtils.isEmpty(data.getUser().getUserId())) {
                    if (!Store.getInstance().getuserId().equals(data.getUser().getUserId()))
                        reportAdvertAction(TrackConstants.ACTION_HOME_MESSAGE, TrackConstants.NOTE_HOME_MESSAGE);
                    mContext.startActivity(new Intent(mContext, FriendsDetailsActivity.class).putExtra("USER_ID", data.getUser().getUserId()));

                }
            });

            //用户分享
            myHolder.mShare.setTag("share");
            myHolder.mShare.setOnClickListener(v -> {
                if (!Store.getInstance().isLogin()) {
                    mContext.startActivity(new Intent(mContext, LoginActivity.class));
                } else {
                    reportAdvertAction(TrackConstants.ACTION_HOME_SHARE, TrackConstants.NOTE_HOME_SHARE);
                    Store.getInstance().setVideoId(String.valueOf(data.getId()));
                    new XPopup.Builder(context)
                            .hasShadowBg(false) // 去掉半透明背景
                            .asCustom(new ShareVideoPopup(context, data.getDescription(), data.getDescription(), data.getId() + ""))
                            .show();
                    if (mItemBtnClick != null) mItemBtnClick.onJumpShare();
                }
            });

            myHolder.mComment.setOnClickListener(v -> {
                if (data.getUser() != null) {
                    if (mItemBtnClick != null) {
                        mItemBtnClick.onJumpComment(data.getId() + "", data.getUser().getAvatarUrl(), data.getCommentCount(), myHolder.getAdapterPosition());
                        reportAdvertAction(TrackConstants.ACTION_HOME_COMMENT, TrackConstants.NOTE_HOME_COMMENT);
                    }
                }


            });
            myHolder.ivFllow.setOnClickListener(v -> {
                if (!Store.getInstance().isLogin()) {
                    mContext.startActivity(new Intent(mContext, LoginActivity.class));
                } else {
                    if (data.getUser() != null && !TextUtils.isEmpty(data.getUser().getUserId())) {
                        myHolder.ivFllow.setEnabled(false);
                        HttpData.getInstance().getFocusType(Integer.parseInt(data.getUser().getUserId()), new AbsCallback<BaseData<FocusType>>() {
                            @Override
                            public void onRealSuccess(BaseData<FocusType> focusType) {
                                myHolder.ivFllow.setEnabled(true);
                                //0未关注,1已关注,2互相关注
                                if (focusType == null || focusType.getData() == null) {
                                    return;
                                }
                                int followStatus = focusType.getData().getFollow_status();
                                data.setFollow_status(followStatus);
                                if (followStatus == 0) {
                                    ToastUtil.showToast(mContext, "您已取消关注该用户");
                                } else if (followStatus == 1) {
                                    ToastUtil.showToast(mContext, "您已成功关注该用户");
                                    myHolder.ivFllow.setVisibility(View.GONE);
                                }
                            }

                            @Override
                            public void onFail(int errCode, String errMsg) {
                                myHolder.ivFllow.setEnabled(true);
                            }
                        });
                        reportAdvertAction(TrackConstants.ACTION_HOME_ATTENTION, TrackConstants.NOTE_HOME_ATTENTION);
                    }
//                        followOrUnFollow(Integer.parseInt(data.getUser().getUserId()), v);

                }
            });

            updateUI(myHolder, data);

            if (data.getType() != Constants.AD.ad_item_type) {
                getVideoInfo(data.getId(), myHolder, data, false);
            }
        }
    }

    private void reportAdvertAction(String action, String note) {
        TrackManager.getInstance().reportAdvertAction(TrackConstants.PAGE_ID_HOME, action, note);
    }

    private int isAdStart = 0;

    public boolean isAdStart() {
        return isAdStart == 1;
    }

    @Override
    public void onViewAttachedToWindow(@NonNull MyHolder holder) {
        super.onViewAttachedToWindow(holder);
        mCurrentHolder = holder;
        if (mCurrentHolder == null || mCurrentHolder.getCurrentModel() == null) {
            return;
        }
        isAdStart = 0;
        View adview = mCurrentHolder.getAdview();
        if (adview != null) {
            mCurrentHolder.setAdview(null);
            mCurrentHolder.videoLayout.removeView(adview);
            ViewParent parent = adview.getParent();
            if (parent != null) {
                FrameLayout frameLayout = (FrameLayout) parent;
                frameLayout.removeView(adview);
            }
        }
        if (mCurrentHolder.getCurrentModel().getType() == 100) {
            TTNativeExpressAd ad = mCurrentHolder.getCurrentModel().getAd();
            if (ad != null) {
                ad.setVideoAdListener(new TTNativeExpressAd.ExpressVideoAdListener() {
                    @Override
                    public void onVideoLoad() {
//                        Log.d("AdSlot", "onVideoLoad!");
                    }

                    @Override
                    public void onVideoError(int errorCode, int extraCode) {
//                        Log.d("AdSlot", "onVideoError!");
                    }

                    @Override
                    public void onVideoAdStartPlay() {
//                        Log.d("AdSlot", "onVideoAdStartPlay!");
                        isAdStart++;
                        if (mItemBtnClick != null && isAdStart == 1) {
                            mItemBtnClick.onAdPlayStart();
                        }
                    }

                    @Override
                    public void onVideoAdPaused() {
//                        Log.d("AdSlot", "onVideoAdPaused!");
                        isAdStart--;
                        if (mItemBtnClick != null) {
                            mItemBtnClick.onAdPlayPaused();
                        }
                    }

                    @Override
                    public void onVideoAdContinuePlay() {
//                        Log.d("AdSlot", "onVideoAdContinuePlay!");
                    }

                    @Override
                    public void onProgressUpdate(long current, long duration) {
//                        Log.d("AdSlot", "onProgressUpdate!");
                    }

                    @Override
                    public void onVideoAdComplete() {
//                        Log.d("AdSlot", "onVideoAdComplete!");
                        isAdStart = Integer.MAX_VALUE;
                        if (mItemBtnClick != null) {
                            mItemBtnClick.onAdPlayComplete();
                        }
                    }

                    @Override
                    public void onClickRetry() {
//                        Log.d("AdSlot", "onClickRetry!");
                    }
                });
                View view = ad.getExpressAdView();
                ViewParent parent = view.getParent();
                if (parent != null) {
                    FrameLayout frameLayout = (FrameLayout) parent;
                    frameLayout.removeView(view);
                }
                mCurrentHolder.setAdview(view);
                mCurrentHolder.videoLayout.removeView(view);
                mCurrentHolder.videoLayout.addView(view, 0);
                mCurrentHolder.root.setVisibility(View.GONE);
            }
        } else {
            mCurrentHolder.root.setVisibility(View.VISIBLE);
            if (holder.getCurrentModel().getType() == 3 && "CPM".equals(holder.getCurrentModel().getAdvert_charge_type())) {
                advertRecord(holder.getCurrentModel());
            }
        }
    }

    public MyHolder getCurrentHolder() {
        return mCurrentHolder;
    }

    private void updateUI(final MyHolder myHolder, final BaseVideoSourceModel data) {
        if (data.isLove()) {
            myHolder.loveIcon.setBackgroundResource(R.drawable.like_selected);
        } else {
            myHolder.loveIcon.setBackgroundResource(R.drawable.love);
        }
        if (data.getType() == 3) {
            myHolder.tvName.setText(data.getTitle());
            myHolder.ivFllow.setVisibility(View.GONE);
            myHolder.btUnderstand.setVisibility(View.VISIBLE);
            myHolder.btUnderstand.setOnClickListener(v -> {
                try {
                    String url = TextUtils.isEmpty(data.getAdvert_url()) ? "www.baidu.com" : data.getAdvert_url();
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.VIEW");
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    Uri content_url = Uri.parse(url);
                    intent.setData(content_url);
                    mContext.startActivity(intent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if ("CPC".equals(data.getAdvert_charge_type())) {
                    advertRecord(data);
                }
            });
        } else {
            if (data.getUser() != null) {
                String userName = data.getUser().getUserName() == null ? "" : data.getUser().getUserName();
                if (data.getType() == 1) {
                    myHolder.tvMusic.setText("@" + userName + "创作");
                } else {
                    myHolder.tvMusic.setText("@" + userName);
                }
                myHolder.tvName.setText("@" + userName);
            }
            myHolder.btUnderstand.setVisibility(View.GONE);
        }

        RequestOptions requestOptions = RequestOptions.circleCropTransform();

        Glide.with(ShuaApplication.getContext()).load(data.getUser() != null ? data.getUser().getAvatarUrl() : "").apply(requestOptions)
                .placeholder(R.drawable.changdou_reound_logo)
                .into(myHolder.ivIcon);


        myHolder.tvInform.setText(data.getDescription());
        myHolder.tvCommentNumber.setText(NumberUtils.INSTANCE.convertOneDecimalW(data.getCommentCount()));
        myHolder.tvPraiseCount.setText(NumberUtils.INSTANCE.convertOneDecimalW(data.getPraiseCount()));
        myHolder.tvForwardCount.setText(NumberUtils.INSTANCE.convertOneDecimalW(data.getForwardCount()));
        // 平台广告
        int type = data.getType();

        if (data.isPublish() || type == Constants.AD.ad_item_type) {
            myHolder.ivFllow.setVisibility(View.GONE);
        } else if (data.getFollow_status() == 0) {
            myHolder.ivFllow.setEnabled(true);
            myHolder.ivFllow.setVisibility(View.VISIBLE);
        } else {
            myHolder.ivFllow.setVisibility(View.GONE);
        }


        myHolder.tvAdDetail.setVisibility(type == Constants.AD.ad_item_type ? View.VISIBLE : View.GONE);
        myHolder.praiseLayout.setVisibility(type == Constants.AD.ad_item_type ? View.GONE : View.VISIBLE);
        myHolder.shareLayout.setVisibility(type == Constants.AD.ad_item_type ? View.GONE : View.VISIBLE);
        myHolder.commentLayout.setVisibility(type == Constants.AD.ad_item_type ? View.GONE : View.VISIBLE);
        myHolder.ivAdSign.setVisibility(type == Constants.AD.ad_item_type ? View.VISIBLE : View.GONE);
        if (type == Constants.AD.ad_item_type) {

            myHolder.tvAdDetail.setText(data.link_type.equals("2") ? "立即下载" : "查看详情");
            myHolder.tvInform.setText(data.getDescription());
            myHolder.root.setOnClickListener(v -> {
                if (mItemBtnClick != null && data.getType() == Constants.AD.ad_item_type &&
                        (getCurrentHolder() != null && getCurrentHolder().getCurrentModel() != null &&
                                getCurrentHolder().getCurrentModel().getType() == Constants.AD.ad_item_type)) {
                    mItemBtnClick.onJumpAdDetail(data.link_type, data.jump_url);
                } else {
                    // 暂停视频
                    if (mItemBtnClick != null) {
                        mItemBtnClick.onPauseVideo();
                    }
                }
            });
        }
    }

    @Override
    public void onViewRecycled(@NonNull MyHolder holder) {
        super.onViewRecycled(holder);
    }


    private void getVideoInfo(int id, final MyHolder myHolder, final BaseVideoSourceModel videoSourceModel, boolean icClick) {
        HttpData.getInstance().getVideoInfo(id, new ACallback<BaseData<VideoInfo>>() {
            @Override
            public void onSuccess(BaseData<VideoInfo> data) {
                if (data == null || !data.isStatus() || data.getData() == null || videoSourceModel == null || myHolder == null || myHolder.getAdapterPosition() < 0
                        || (myHolder.getCurrentModel() != null && myHolder.getCurrentModel().getType() == Constants.AD.ad_item_type)) {
                    return;
                }
                if (videoSourceModel.getType() == Constants.AD.ad_item_type || (getCurrentHolder() != null && getCurrentHolder().getCurrentModel() != null &&
                        getCurrentHolder().getCurrentModel().getType() == Constants.AD.ad_item_type)) {
                    return;
                }
                try {
                    if (videoSourceModel instanceof LittleMineVideoInfo.VideoListBean) {
                        LittleMineVideoInfo.VideoListBean videoListBean = (LittleMineVideoInfo.VideoListBean) videoSourceModel;
                        VideoInfo dataBean = data.getData();
                        videoListBean.setVideoId(dataBean.getMedia_id());
                        videoListBean.setVideoUrl(dataBean.getMedia_url());
                        videoListBean.setFirstFrameUrl(dataBean.getAvatar());
                        videoListBean.setDescription(dataBean.getDescription());
                        BaseVideoSourceModel.UserBean userBean = new BaseVideoSourceModel.UserBean();
                        userBean.setAvatarUrl(dataBean.getUser().getAvatar());
                        userBean.setUserId(dataBean.getUser().getId() + "");
                        userBean.setUserName(dataBean.getUser().getName());
                        videoListBean.setUser(userBean);
                        videoListBean.setType(dataBean.getType());
                        videoListBean.setId(dataBean.getId());
                        videoListBean.setShareUrl(dataBean.getMedia_url());
                        videoListBean.setTitle(dataBean.getTitle());
                        videoListBean.setLocation(dataBean.getLocation());
                        videoListBean.setCommentCount(dataBean.getComment_count());
                        videoListBean.setPraiseCount(dataBean.getPraise_count());

                        videoListBean.setForwardCount(dataBean.getForward_count());
                        videoListBean.setFollow_status(dataBean.getFollow_status());

                        videoListBean.setLove(dataBean.getIs_praise_user());

                        videoListBean.setServer_time(dataBean.getServer_time());

                        videoListBean.setAdvert_url(dataBean.getAdvert_url());
                        videoListBean.setAdvert_html(dataBean.getAdvert_html());
                        videoListBean.setAdvert_charge_type(dataBean.getAdvert_charge_type());

                        if (icClick && videoSourceModel.isLove()) {
                            myHolder.loveIcon.setBackgroundResource(R.drawable.love_animation_list);
                            AnimationDrawable animal = (AnimationDrawable) myHolder.loveIcon.getBackground();
                            animal.start();
                            new Handler().postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    animal.stop();
                                    updateUI(myHolder, videoSourceModel);
                                }
                            }, 900);
                        } else {
                            updateUI(myHolder, videoSourceModel);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    updateUI(myHolder, videoSourceModel);
                }
            }

            @Override
            public void onFail(int errCode, String errMsg) {
            }
        });
    }

    public void onHearClick(BaseVideoSourceModel mCurrentModel) {
        if (mCurrentModel.getType() == Constants.AD.ad_item_type) return;
        final MyHolder myHolder = (MyHolder) mCurrentModel.currentHolder;
        if (myHolder != null) {
            if (!mCurrentModel.isLove()) {
                reportAdvertAction(TrackConstants.ACTION_HOME_DOUBLELIKE, TrackConstants.NOTE_HOME_DOUBLELIKE);
                myHolder.mLove.performClick();
            }
        }
    }

    private void advertRecord(BaseVideoSourceModel videoSourceModel) {
        HttpData.getInstance().advertRecord(videoSourceModel.getId() + "", new ACallback<BaseData>() {
            @Override
            public void onSuccess(BaseData data) {
            }

            @Override
            public void onFail(int errCode, String errMsg) {
            }
        });
    }

    public void onResume() {
        if (mCurrentHolder == null || mCurrentHolder.getCurrentModel() == null || mCurrentHolder.getCurrentModel().getType() == 100
                || mCurrentHolder.getCurrentModel().getType() == Constants.AD.ad_item_type) {
            return;
        }
        getVideoInfo(mCurrentHolder.getCurrentModel().getId(), mCurrentHolder, mCurrentHolder.getCurrentModel(), false);
    }

    public void onPause() {
    }

    public final class MyHolder extends BaseVideoListAdapter.BaseHolder {

        private BaseVideoSourceModel mCurrentModel;

        private ImageView thumb, loveIcon, ivIcon;
        private View ivFllow;
        public FrameLayout playerView;
        private ViewGroup mRootView;
        private FrameLayout mLove, mShare, mComment;
        private TextView tvName, tvInform, tvMusic, tvPraiseCount, tvForwardCount, tvCommentNumber;
        private Button btUnderstand;
        private ConstraintLayout root;
        private FrameLayout videoLayout;
        private View adview;
        private TextView tvAdDetail;

        private LinearLayout userLayout;
        private LinearLayout praiseLayout;
        private LinearLayout commentLayout;
        private LinearLayout shareLayout;
        private LinearLayout bottomLayout;
        private ImageView ivAdSign;

        MyHolder(@NonNull View itemView) {
            super(itemView);
            Log.d(TAG, "new PlayerManager");
            root = itemView.findViewById(R.id.video_root);
            videoLayout = itemView.findViewById(R.id.video_layout);
            thumb = itemView.findViewById(R.id.img_thumb);
            playerView = itemView.findViewById(R.id.player_view);
            mRootView = itemView.findViewById(R.id.root_view);
            mLove = itemView.findViewById(R.id.love);
            loveIcon = itemView.findViewById(R.id.love_icon);
            mShare = itemView.findViewById(R.id.share);
            mComment = itemView.findViewById(R.id.message);
            tvName = itemView.findViewById(R.id.tv_name);
            tvInform = itemView.findViewById(R.id.tv_inform);
            btUnderstand = itemView.findViewById(R.id.bt_understand);
            tvMusic = itemView.findViewById(R.id.tv_music);
            ivIcon = itemView.findViewById(R.id.iv_icon);
            tvPraiseCount = itemView.findViewById(R.id.tv_praise_count);
            tvForwardCount = itemView.findViewById(R.id.tv_forward_count);
            tvCommentNumber = itemView.findViewById(R.id.tv_comment_number);
            tvAdDetail = itemView.findViewById(R.id.tv_ad_detail);

            ivFllow = itemView.findViewById(R.id.iv_fllow);
            userLayout = itemView.findViewById(R.id.iv_icon_layout);
            praiseLayout = itemView.findViewById(R.id.layout_praise);
            shareLayout = itemView.findViewById(R.id.layout_share);
            commentLayout = itemView.findViewById(R.id.layout_comment);
            bottomLayout = itemView.findViewById(R.id.add_layout);
            ivAdSign = itemView.findViewById(R.id.iv_ad_sign);

            // setIsRecyclable(false);
        }

        @Override
        public ImageView getCoverView() {
            return thumb;
        }

        @Override
        public ViewGroup getContainerView() {
            return mRootView;
        }

        public BaseVideoSourceModel getCurrentModel() {
            return mCurrentModel;
        }

        public void setCurrentModel(BaseVideoSourceModel currentModel) {
            this.mCurrentModel = currentModel;
        }

        public View getAdview() {
            return adview;
        }

        public void setAdview(View adview) {
            this.adview = adview;
        }
    }

    public interface OnItemBtnClick {
        void onDownloadClick(int position);

        /**
         * @param videoId
         * @param headerUrl
         * @param commentCount
         * @param position     adapter position
         */
        void onJumpComment(String videoId, String headerUrl, int commentCount, int position);

        void onJumpShare();


        void onAdPlayStart();

        void onAdPlayPaused();

        void onAdPlayComplete();

        // 跳转到广告详情
        void onJumpAdDetail(String link_type, String url);

        void onPauseVideo();
    }

    public void setItemBtnClick(
            OnItemBtnClick mItemBtnClick) {
        this.mItemBtnClick = mItemBtnClick;
    }

}
